import com.uperform.coach.tdd.TddApplication;
import io.cucumber.java.en.And;
import io.cucumber.spring.CucumberContextConfiguration;
import org.springframework.boot.test.context.SpringBootContextLoader;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.CoreMatchers.is;

@ActiveProfiles(profiles = "ac")
@ContextConfiguration(classes = {TddApplication.class}, loader = SpringBootContextLoader.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@CucumberContextConfiguration
public class NumberAdd {
    private int number1;
    private int number2;
    private int result;

    @io.cucumber.java.en.Given("^给定数字1 (\\d+)$")
    public void 给定数字1(int number) {
        this.number1 = number;
    }

    @io.cucumber.java.en.Given("^给定数字2 (\\d+)$")
    public void 给定数字2(int number) {
        this.number2 = number;
    }

    @io.cucumber.java.en.When("^执行加法$")
    public void 执行加法() {
        this.result = this.number1 + this.number2;
    }

    @io.cucumber.java.en.Then("^结果为 (\\d+)$")
    public void 结果为(int result) {
        assertThat(this.result, is(result));
    }

    @And("给定对象")
    public void 给定对象(String content) {
    }
}
